using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpaceTimePatternMiningTools._SpaceTimePatternAnalysis
{
    /// <summary>
    /// <para>Time Series Clustering</para>
    /// <para>Partitions a collection of time series, stored in a space-time cube, based on the similarity of time series characteristics. Time series can be clustered based on three criteria: having similar values across time, tending to increase and decrease at the same time, and having similar repeating patterns. The output of this tool is a 2D map displaying each location in the cube symbolized by cluster membership and messages. The output also includes charts containing information about the representative time series signature for each cluster.</para>
    /// <para>根据时间序列特征的相似性对存储在时空多维数据集中的时间序列集合进行分区。时间序列可以根据三个条件进行聚类：在时间上具有相似的值，倾向于同时增加和减少，以及具有相似的重复模式。此工具的输出是一个 2D 地图，其中显示了由集群成员身份和消息符号化的立方体中的每个位置。输出还包括图表，其中包含有关每个聚类的代表性时间序列签名的信息。</para>
    /// </summary>    
    [DisplayName("Time Series Clustering")]
    public class TimeSeriesClustering : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TimeSeriesClustering()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_cube">
        /// <para>Input Space Time Cube</para>
        /// <para>The netCDF cube to be analyzed. This file must have an .nc extension and must have been created using the Create Space Time Cube By Aggregating Points, Create Space Time Cube From Defined Features, or Create Space Time Cube From Multidimensional Raster Layer tool.</para>
        /// <para>要分析的 netCDF 多维数据集。此文件必须具有 .nc 扩展名，并且必须已使用通过聚合点创建时空立方体、根据定义要素创建时空立方体或从多维栅格图层创建时空立方体工具创建。</para>
        /// </param>
        /// <param name="_analysis_variable">
        /// <para>Analysis Variable</para>
        /// <para>The numeric variable in the netCDF file, changing over time, that will be used to distinguish one cluster from another.</para>
        /// <para>netCDF 文件中的数值变量，随时间而变化，将用于区分一个集群和另一个集群。</para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The new output feature class containing all locations in the space-time cube and a field indicating cluster membership. This feature class will be a two-dimensional representation of the clusters in your data.</para>
        /// <para>包含时空立方体中所有位置和指示聚类成员资格的字段的新输出要素类。此要素类将是数据中聚类的二维表示形式。</para>
        /// </param>
        /// <param name="_characteristic_of_interest">
        /// <para>Characteristic of Interest</para>
        /// <para><xdoc>
        ///   <para>Specifies the characteristic of the time series that will be used to determine which locations should be clustered together.</para>
        ///   <bulletList>
        ///     <bullet_item>Value— Locations with similar values across time will be clustered together.</bullet_item><para/>
        ///     <bullet_item>Profile (Correlation)—Locations with values that tend to increase and decrease proportionally at the same times will be clustered together.</bullet_item><para/>
        ///     <bullet_item>Profile (Fourier)—Locations with values that have similar smooth, periodic patterns will be clustered together.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于确定哪些位置应聚类在一起的时间序列的特征。</para>
        ///   <bulletList>
        ///     <bullet_item>值 - 随时间推移具有相似值的位置将聚类在一起。</bullet_item><para/>
        ///     <bullet_item>剖面（相关性）—具有同时按比例增加和减少的值的位置将聚类在一起。</bullet_item><para/>
        ///     <bullet_item>剖面（傅里叶）—具有相似平滑周期模式的值的位置将聚类在一起。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public TimeSeriesClustering(object _in_cube, object _analysis_variable, object _output_features, _characteristic_of_interest_value? _characteristic_of_interest)
        {
            this._in_cube = _in_cube;
            this._analysis_variable = _analysis_variable;
            this._output_features = _output_features;
            this._characteristic_of_interest = _characteristic_of_interest;
        }
        public override string ToolboxName => "Space Time Pattern Mining Tools";

        public override string ToolName => "Time Series Clustering";

        public override string CallName => "stpm.TimeSeriesClustering";

        public override List<string> AcceptEnvironments => ["parallelProcessingFactor", "randomGenerator"];

        public override object[] ParameterInfo => [_in_cube, _analysis_variable, _output_features, _characteristic_of_interest.GetGPValue(), _cluster_count, _output_table_for_charts, _shape_characteristic_to_ignore, _enable_time_series_popups.GetGPValue()];

        /// <summary>
        /// <para>Input Space Time Cube</para>
        /// <para>The netCDF cube to be analyzed. This file must have an .nc extension and must have been created using the Create Space Time Cube By Aggregating Points, Create Space Time Cube From Defined Features, or Create Space Time Cube From Multidimensional Raster Layer tool.</para>
        /// <para>要分析的 netCDF 多维数据集。此文件必须具有 .nc 扩展名，并且必须已使用通过聚合点创建时空立方体、根据定义要素创建时空立方体或从多维栅格图层创建时空立方体工具创建。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Space Time Cube")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_cube { get; set; }


        /// <summary>
        /// <para>Analysis Variable</para>
        /// <para>The numeric variable in the netCDF file, changing over time, that will be used to distinguish one cluster from another.</para>
        /// <para>netCDF 文件中的数值变量，随时间而变化，将用于区分一个集群和另一个集群。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Analysis Variable")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _analysis_variable { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para>The new output feature class containing all locations in the space-time cube and a field indicating cluster membership. This feature class will be a two-dimensional representation of the clusters in your data.</para>
        /// <para>包含时空立方体中所有位置和指示聚类成员资格的字段的新输出要素类。此要素类将是数据中聚类的二维表示形式。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Characteristic of Interest</para>
        /// <para><xdoc>
        ///   <para>Specifies the characteristic of the time series that will be used to determine which locations should be clustered together.</para>
        ///   <bulletList>
        ///     <bullet_item>Value— Locations with similar values across time will be clustered together.</bullet_item><para/>
        ///     <bullet_item>Profile (Correlation)—Locations with values that tend to increase and decrease proportionally at the same times will be clustered together.</bullet_item><para/>
        ///     <bullet_item>Profile (Fourier)—Locations with values that have similar smooth, periodic patterns will be clustered together.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于确定哪些位置应聚类在一起的时间序列的特征。</para>
        ///   <bulletList>
        ///     <bullet_item>值 - 随时间推移具有相似值的位置将聚类在一起。</bullet_item><para/>
        ///     <bullet_item>剖面（相关性）—具有同时按比例增加和减少的值的位置将聚类在一起。</bullet_item><para/>
        ///     <bullet_item>剖面（傅里叶）—具有相似平滑周期模式的值的位置将聚类在一起。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Characteristic of Interest")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _characteristic_of_interest_value? _characteristic_of_interest { get; set; }

        public enum _characteristic_of_interest_value
        {
            /// <summary>
            /// <para>Value</para>
            /// <para>Value— Locations with similar values across time will be clustered together.</para>
            /// <para>值 - 随时间推移具有相似值的位置将聚类在一起。</para>
            /// </summary>
            [Description("Value")]
            [GPEnumValue("VALUE")]
            _VALUE,

            /// <summary>
            /// <para>Profile (Correlation)</para>
            /// <para>Profile (Correlation)—Locations with values that tend to increase and decrease proportionally at the same times will be clustered together.</para>
            /// <para>剖面（相关性）—具有同时按比例增加和减少的值的位置将聚类在一起。</para>
            /// </summary>
            [Description("Profile (Correlation)")]
            [GPEnumValue("PROFILE")]
            _PROFILE,

            /// <summary>
            /// <para>Profile (Fourier)</para>
            /// <para>Profile (Fourier)—Locations with values that have similar smooth, periodic patterns will be clustered together.</para>
            /// <para>剖面（傅里叶）—具有相似平滑周期模式的值的位置将聚类在一起。</para>
            /// </summary>
            [Description("Profile (Fourier)")]
            [GPEnumValue("PROFILE_FOURIER")]
            _PROFILE_FOURIER,

        }

        /// <summary>
        /// <para>Number of Clusters</para>
        /// <para>The number of clusters to create. When left empty, the tool will evaluate the optimal number of clusters using a pseudo-F statistic. The optimal number of clusters will be reported in the messages window.</para>
        /// <para>要创建的集群数。如果留空，该工具将使用伪 F 统计量评估最佳聚类数。最佳集群数将在消息窗口中报告。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Clusters")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _cluster_count { get; set; } = null;


        /// <summary>
        /// <para>Output Table for Charts</para>
        /// <para>If specified, this table contains the representative time series for each cluster based on both the average for each time series cluster and the medoid time series. Charts created from this table can be accessed in the Standalone Tables section.</para>
        /// <para>如果指定，此表将包含每个聚类的代表性时间序列，该时间序列基于每个时间序列聚类的平均值和中间时间序列。从此表创建的图表可以在“独立表”部分中访问。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table for Charts")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_table_for_charts { get; set; } = null;


        /// <summary>
        /// <para>Time Series Characteristics to Ignore</para>
        /// <para><xdoc>
        ///   <para>Specifies characteristics that will be ignored when determining the similarity between two time series.</para>
        ///   <bulletList>
        ///     <bullet_item>Time lag— The starting time of each period, including time lags, will be ignored. For example, if two time series have similar periodic patterns, but the values of one are three days behind the other, the time series will be considered similar.</bullet_item><para/>
        ///     <bullet_item>Range—The magnitude of the values in each period will be ignored. For example, if two time series begin and end their periods at the same times, they will be considered similar, even if the actual values are very different.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>If both characteristics are ignored, two time series will be considered similar if the durations of the periods are similar, even if they start at different times and have different values within the periods.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在确定两个时间序列之间的相似性时将忽略的特征。</para>
        ///   <bulletList>
        ///     <bullet_item>时间滞后— 每个周期的开始时间（包括时间滞后）将被忽略。例如，如果两个时间序列具有相似的周期模式，但其中一个时间序列的值比另一个时间序列晚三天，则该时间序列将被视为相似。</bullet_item><para/>
        ///     <bullet_item>范围—将忽略每个周期中值的大小。例如，如果两个时间序列同时开始和结束其周期，则即使实际值非常不同，它们也将被视为相似。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>如果忽略这两个特征，则如果周期的持续时间相似，则两个时间序列将被视为相似，即使它们在不同的时间开始并且在周期内具有不同的值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Series Characteristics to Ignore")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _shape_characteristic_to_ignore { get; set; } = null;


        /// <summary>
        /// <para>Enable Time Series Pop-ups</para>
        /// <para><xdoc>
        ///   <para>Specifies whether time series charts will be created in the pop-ups of each output feature showing the time series of the feature and the average time series of all features in the same cluster as the feature.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Time series charts will be created for the output features.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Time series charts will not be created. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否在每个输出要素的弹出窗口中创建时序图，以显示要素的时间序列以及与要素位于同一聚类中的所有要素的平均时间序列。</para>
        ///   <bulletList>
        ///     <bullet_item>选中—将为输出要素创建时间序列图表。</bullet_item><para/>
        ///     <bullet_item>未选中—不会创建时间序列图表。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Enable Time Series Pop-ups")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _enable_time_series_popups_value _enable_time_series_popups { get; set; } = _enable_time_series_popups_value._false;

        public enum _enable_time_series_popups_value
        {
            /// <summary>
            /// <para>CREATE_POPUP</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("CREATE_POPUP")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_POPUP</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_POPUP")]
            [GPEnumValue("false")]
            _false,

        }

        public TimeSeriesClustering SetEnv(object parallelProcessingFactor = null, object randomGenerator = null)
        {
            base.SetEnv(parallelProcessingFactor: parallelProcessingFactor, randomGenerator: randomGenerator);
            return this;
        }

    }

}